
#include <BPlane>
#include "IAlgorithm.h"
#include "ITriangleShape.h"

using namespace BWE;

ITriangleShape::ITriangleShape()
{

}
ITriangleShape::ITriangleShape(const BVector& va, const BVector& vb, const BVector& vc)
{
	m_triangle.set(va, vb, vc);
}
ITriangleShape::ITriangleShape(const BTriangle& triangle)
{
	m_triangle = triangle;
}

void ITriangleShape::setTriangle(const BVector& va, const BVector& vb, const BVector& vc)
{
	m_triangle.set(va, vb, vc);
}
void ITriangleShape::setTriangle(const BTriangle& triangle)
{
	m_triangle = triangle;
}
const BTriangle& ITriangleShape::triangle() const
{
	return m_triangle;
}

const BVector& ITriangleShape::va() const
{
	return m_triangle.a();
}
const BVector& ITriangleShape::vb() const
{
	return m_triangle.b();
}
const BVector& ITriangleShape::vc() const
{
	return m_triangle.c();
}

BVector ITriangleShape::inertia(BReal mass) const
{
	return BVector();
}
BVector ITriangleShape::vertex(const BVector& direct) const
{
	BVector dots(direct.dot(m_triangle.a()), direct.dot(m_triangle.b()), direct.dot(m_triangle.c()));
	int index = MaxAxis(dots);
	return m_triangle[index];
}

void ITriangleShape::refresh(BBox& box)
{

}
void ITriangleShape::render(BRender& render)
{

}
